package com.aitaoxue.palx.ui;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.InjectView;

import com.aitaoxue.palx.R;
import com.aitaoxue.palx.api.ApiHttpClient;
import com.aitaoxue.palx.base.BaseActivity;
import com.nostra13.universalimageloader.core.ImageLoader;

public class ErrorBookItemActivity extends BaseActivity {

	@InjectView(R.id.content)
	protected TextView desc;
	@InjectView(R.id.img)
	protected ImageView img;
	@InjectView(R.id.rollback)
	protected TextView content;

	@Override
	protected boolean hasBackButton() {
		return true;
	}

	@Override
	protected int getLayoutId() {
		return R.layout.error_book_detail;
	}

	@Override
	protected int getActionBarTitle() {
		return R.string.error_book_detail;
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.img:
			Intent intent = new Intent(this, PhotoActivity.class);
			intent.putExtra("img_url", getIntent().getStringExtra("img_url"));
			intent.putExtra("desc", getIntent().getStringExtra("desc"));
			startActivity(intent);
			break;

		default:
			break;
		}
	}

	@Override
	public void initView() {
		desc.setText(getIntent().getStringExtra("desc"));

		ImageLoader.getInstance().displayImage(
				ApiHttpClient.ERROR_BOOK_PREFIX
						+ getIntent().getStringExtra("img_url"), img);
	}

	@Override
	public void initData() {
		img.setOnClickListener(this);
	}

}
